package com.fsnbigdata.domain.query;

import com.fsnbigdata.domain.QDocument;
import com.querydsl.core.types.EntityPath;
import com.querydsl.core.types.dsl.StringExpression;
import org.springframework.data.querydsl.binding.QuerydslBinderCustomizer;
import org.springframework.data.querydsl.binding.QuerydslBindings;

/**
 * Created by zhongcheng on 25/12/2017.
 */
public class DocumentQueryDslBinder implements QuerydslBinderCustomizer<QDocument> {

    @Override
    public void customize(QuerydslBindings bindings, QDocument root) {
        bindings.bind(root.name).first(StringExpression::containsIgnoreCase);
        bindings.bind(root.author).first(StringExpression::containsIgnoreCase);
        bindings.bind(root.docYear).first(StringExpression::containsIgnoreCase);
    }
}
